Most modern cameras provide some mechanism for automatic focus adjustment. The automatic focus adjustment mechanism typically includes an electronic controller and a motorized lens assembly. The electronic controller typically implements an algorithm that compares a plurality of focusing images provided at multiple positions of focus. The multiple positions of focus are obtained by stepping the motorized lens assembly through a plurality of lens focus positions, thereby changing the focus point for each of the focusing images.
A calculation is performed on a region of each of the focusing images to provide a figure of merit (FOM), which represents in some way, the closeness of the focusing images to the correct focusing position. There are a number of different FOMs used for different applications. In one example, the FOM calculation includes an edge detection algorithm across the region and a summation of all of the resulting values. Typically, the image representing the lens focus position which provides the maximum value (for instance, the sum of the edge detections), is treated as the optimized focus point for obtaining an image.
In another example, the spatial variance of the image serves as the FOM. When the lens is out of focus, the blur operates like a spatial low-pass filter, decreasing the variance. The spatial variance is therefore maximized when the lens is in focus. The spatial variance FOM depends on the scene illumination level, as well as the scene content and lens focus setting. The variation of the FOM with illumination intensity can cause the focus control algorithm to fail if the illumination level changes with time, as in the case of fluorescent lights. Typically, if the focus control algorithm is presented with a focus FOM change caused by an illumination variation, the focus control algorithm will interpret it as an error in focus position and will make an erroneous correction to the focal position.
The conventional FOMs implemented by focus control algorithms perform relatively well under ideal conditions, such as, when the focusing images contain relatively large objects, when there is little or no noise, and when the focusing images are captured at constant illumination. However, ideal conditions are often not encountered and thus, focus control algorithms that employ the conventional FOMs are typically negatively biased by these conditions, which often leads to less than optimized focus positions for obtaining images. For instance, in order to minimize the time required to perform an automatic focusing operation, focusing images are obtained over a relatively short period of time thereby causing focusing images to typically contain a relatively large amount of noise. Noise, therefore, plays a crucial role in determining conventional figures of merit.